package swa2012.telco.provider.deploy;

import java.net.URI;
import java.net.URISyntaxException;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

import swa2012.telco.broker.Broker;
import swa2012.telco.broker.beans.BrokerRegistrationStatus;
import swa2012.telco.broker.beans.Provider;
/**
 * @author kumar aberer
 * @date 15.06.2012
 */

public class RegisterCallBackManually {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws URISyntaxException {
		
		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		factory.setServiceClass(Broker.class);
		factory.getInInterceptors().add(new LoggingInInterceptor());
		factory.getOutInterceptors().add(new LoggingOutInterceptor());
		factory.setAddress("https://swa.univie.ac.at/TelcoBroker/BrokerService");
		Broker broker = (Broker) factory.create();
		
		Provider provider = new Provider("12",new URI("http://student.swa.univie.ac.at:8012/SWA/BrokerCallback"));
		broker.deregisterProvider(provider);
		BrokerRegistrationStatus status = broker.registerProvider(provider);
		System.out.println("trying to register provider " + provider.getID() + " ..... "+status.name());
				
		

	}

}
